<?php
    include('/../tool/pdo.php');
    include('/../tool/submitValidate.php');
    include('/../class/login.class.php');
    include('/../bll/LoginBLL.php');
    include('/../class/token.class.php');
    include('/../bll/TokenBLL.php');

    $uid = isset($_POST['uid']) ? $_POST['uid'] : "";
    $password = isset($_POST['password']) ? $_POST['password'] : "";
    $token = isset($_POST['token']) ? $_POST['token'] : "";

    if($token!=""){
        $loginBLL=new LoginBLL();
        $message=$loginBLL->tokenLogin($token);
    }else if(!$uid=="" && !$password==""){
        $loginBLL=new LoginBLL();
        $message=$loginBLL->mobileLogin($uid,$password);
    }else{
        $message=array(
            'code'=>'2003',
            'message'=>'请输入用户名和密码'
        );
    }
    
    echo json_encode($message,JSON_UNESCAPED_UNICODE);
?>